<?php

!defined('DEBUG') AND exit('Access Denied.');

$action = param(1);

if(!admin_authority_check()) header("Location:".url('index-login'));

if($action == 'base') {
	
	if($method == 'GET') {
		$header['title'] = "基本设置";
		$header['mobile_title'] = "基本设置";
		include _include(ADMIN_PATH.'view/htm/setting_base.htm');
	} else {
		$common = array();
		$common['sitename'] = param('sitename');
		$common['sitelink'] = param('sitelink');
		$common['sitebrief'] = param('sitebrief');
		$common['keywords'] = param('keywords');
		$common['cash_min'] = param('cash_min');
		$common['cash_max'] = param('cash_max');
		$common['cash_fee_percent'] = param('cash_fee_percent');
		$common['cash_fee_fixed'] = param('cash_fee_fixed');
		$common['bank_card_max'] = param('bank_card_max');
		$common['register_check'] = param('register_check');
		$common['channel_sort'] = param('channel_sort');
		$common['channel_overtimes'] = param('channel_overtimes');
		$common['order_overtime'] = param('order_overtime');
        $common['is_open_sms'] = param('is_open_sms');
		$passcode_old = param('passcode_old');
		$passcode = param('passcode');
		if($passcode!=''){
			if($passcode_old==''){
				message(-1, '请输入原安全码');
			}
			if(md5(md5($passcode_old).'ryTY45Rg')!=$conf['passcode']){
				message(-1, '原安全码不正确');
			}
			$common['passcode'] = md5(md5($passcode).'ryTY45Rg');
		}
		file_replace_var(APP_PATH.'conf/conf.common.php', $common);
		$bank_conf = array('bank'=>explode(',', param('cash_bank')), 'type_bank'=>explode(',', param('cash_type_bank')));
		file_replace_var(APP_PATH.'conf/conf.bank.php', $bank_conf);
		message(0, '修改成功');
	}

}


?>